﻿using System;
using System.Collections;
using System.Collections.Generic;
using LitJson;
using UnityEngine;
using MTUnity.Utils;
using Script.Data;
using Script.Net;
using Script.UI;

public class Task : MonoBehaviour
{
    public MTTimer Timer;
    public static int[] sortLineId = new[] {1, 2, 4, 5, 6, 7, 8, 9, 10};
    private long m_lBeginTimestamp;
    // Start is called before the first frame update
    void Start()
    {
        m_lBeginTimestamp = TimeUtil.GetTimestamp();
        RegisterTask();
    }
    
    public void RegisterTask()
    {
        // 实时温湿度
        Timer.AddTimer(0, 15*60* 1000, RequestCurrentTemperatureAndHumidity, -1);

        // 近12小时的温湿度数据（当前时间往前推12个小时）   
        Timer.AddTimer(0, 12 * 3600 * 1000 , RequestRecordTemperatureAndHumiture, -1);
        
        // 实时仓库数据
        Timer.AddTimer(0, 15 * 60 * 1000, RequestCurrentRepertoryAndStockInOrOut, -1);

        // 历史出入库近14天的效率 
        Timer.AddTimer(0, 14 * 3600 * 24 * 1000, RequestRecordStockInOrOut, -1);
        
        // 实时能耗
        Timer.AddTimer(0, 15*60* 1000, RequestCurrentEnergy, -1);

        // 近12小时的能耗数据（当天） 
        Timer.AddTimer(0, 12 * 3600 * 1000 , RequestRecordEnergy, -1);
        
        // 实时分拣线数据
        Timer.AddTimer(0, 15*60* 1000, RequestCurrentSortLine, -1);
        
        // 近14日分拣线数据
        Timer.AddTimer(0, 14 * 3600 * 24 * 1000, RequestRecordSortLine, -1);
        
        // 实时巡查点数据
        Timer.AddTimer(0, 15*60* 1000, RequestCurrentSpotRoundOfSortingLine, -1);
        
        // 历史巡查点数据
        Timer.AddTimer(0, 7 * 3600 * 24 * 1000, RequestRecordSpotRoundOfSortingLine, -1);
        
        // 温湿度上下限
        Timer.AddTimer(0, 24 * 3600 * 1000, GetTHWarningInfoAsync, -1);
                
        // 报警信息
        Timer.AddTimer(0, 5 * 60 * 1000, GetWarningInfoOfSortLineAsync, -1);
        
        // 实时工单数据
        Timer.AddTimer(0, 15*60* 1000, GetDaySortLineWorkOrderByTypeAsync, -1);
        
        
        // 分拣线位置
        RequestSortLineLocation();
        

        // Timer.AddTimer(0, 5000, TestRequestCurrentEnergyConsumption, -1);
        // Timer.AddTimer(0, 5000, TestRequestCurrentSortingLineData, -1);
        // Timer.AddTimer(0, 5000, TestRequestCurrentSortingCheck, -1);
        // Timer.AddTimer(0, 10000, TestRequestRecordEnergyConsumption, -1);
        // Timer.AddTimer(0, 10000, TestRequestRecordSortingLineData, -1);
        // Timer.AddTimer(0, 10000, TestRequestRecordSortingCheck, -1);

    }

    /// <summary>
    /// 历史温湿度数据
    /// </summary>
    public void RequestRecordTemperatureAndHumiture()
    {
        NetManager.Ins.GetNearHoursTHDataAsync(12,((request, data) =>
        {
            FWarehouse warehouse = FWarehouse.GetInstance();
            var eData = (warehouse.GetEnter().Data as FEnterOrExitData);
            var e2Data = (warehouse.GetExit().Data as FEnterOrExitData);
            foreach (MTJSONObject o in data.list)
            {
                eData.AddHumitureRecord (o["temperature"].i,  o["humidity"].i,TimeUtil.TimeString2Stamp(o["collectionTime"].s)); ;
                e2Data.AddHumitureRecord (o["temperature"].i,  o["humidity"].i,TimeUtil.TimeString2Stamp(o["collectionTime"].s)); ;
            }
            eData.InvalidDataCheck(JsonFildName.Warehouse.Record_Humidity);
            eData.UpdatePullDataTime(JsonFildName.Warehouse.TemperatureRefreshTime, TimeUtil.GetTimestamp());
            e2Data.UpdatePullDataTime(JsonFildName.Warehouse.HumidityRefreshTime, TimeUtil.GetTimestamp());
            
            GlobalEvent.DispatchEvent(EventName.RecordHumitureUpdate);


        }));
    }
    
    /// <summary>
    /// 当前温湿度数据
    /// </summary>
    public void RequestCurrentTemperatureAndHumidity()
    {
        if (UI_MainWnd.Ins)
        {
            UI_MainWnd.Ins.ClearTHrWaringInfo();
        }
        NetManager.Ins.GetCurrentTHAsync(((request, data) =>
        {
            FWarehouse.UpdateCurremtTemperatureTest();
            FWarehouse warehouse = FWarehouse.GetInstance();
            var eData = (warehouse.GetEnter().Data as FEnterOrExitData);
            var e2Data = (warehouse.GetExit().Data as FEnterOrExitData);
            foreach (var mtjsonObject in data.list)
            {
                if (mtjsonObject["humidity"].i >= GlobalValue.MaxLimitTemperature) 
                {
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetEnter().ID,string.Format("{0}温度为{1:f2},超过上限", warehouse.GetEnter().CNName, mtjsonObject["temperature"].i));
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetExit().ID,string.Format("{0}温度为{1:f2},超过上限", warehouse.GetExit().CNName, mtjsonObject["temperature"].i));
                }
                else if (mtjsonObject["humidity"].i >= GlobalValue.MinLimitTemperature)
                {
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetEnter().ID,string.Format("{0}温度为{1:f2}，低于下限", warehouse.GetEnter().CNName, mtjsonObject["temperature"].i));
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetExit().ID, string.Format("{0}温度为{1:f2}，低于下限", warehouse.GetExit().CNName, mtjsonObject["temperature"].i));
                }

                if (mtjsonObject["temperature"].i >= GlobalValue.MaxLimitHumidity)
                {
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetEnter().ID, string.Format("{0}湿度为{1:f2},超过上限", warehouse.GetEnter().CNName, mtjsonObject["humidity"].i));
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetExit().ID, string.Format("{0}湿度为{1:f2},超过上限", warehouse.GetExit().CNName, mtjsonObject["humidity"].i));
                }
                else if (mtjsonObject["temperature"].i >= GlobalValue.MinLimitHumidity)
                {
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetEnter().ID, string.Format("{0}温度为{1:f2}，低于下限", warehouse.GetEnter().CNName, mtjsonObject["humidity"].i));
                    UI_MainWnd.Ins.PushWaringInfo(warehouse.GetExit().ID, string.Format("{0}温度为{1:f2}，低于下限", warehouse.GetExit().CNName, mtjsonObject["humidity"].i));
                }

                eData.CurrentHumidity = mtjsonObject["humidity"].i;
                eData.CurrentTemperature = mtjsonObject["temperature"].i;

                eData.UpdatePullDataTime(JsonFildName.Warehouse.TemperatureRefreshTime,  TimeUtil.TimeString2Stamp((string)mtjsonObject["collectionTime"].s));
                eData.UpdatePullDataTime(JsonFildName.Warehouse.HumidityRefreshTime, TimeUtil.TimeString2Stamp((string)mtjsonObject["collectionTime"].s));
                e2Data.CurrentHumidity = mtjsonObject["humidity"].i;
                e2Data.CurrentTemperature = mtjsonObject["temperature"].i;
                e2Data.UpdatePullDataTime(JsonFildName.Warehouse.TemperatureRefreshTime, TimeUtil.GetTimestamp());
                e2Data.UpdatePullDataTime(JsonFildName.Warehouse.HumidityRefreshTime, TimeUtil.GetTimestamp());
            }

            GlobalEvent.DispatchEvent(EventName.CurrentTemperatureUpdate, new Event_CurrentTemperatureUpdate());
        }));

    }
    
    /// <summary>
    /// 历史能耗数据
    /// </summary>
    public void RequestRecordEnergy()
    {
        foreach (var id in PositionConf.sortLineIdList)
        {
            var conf = PositionConf.GetConfById(id);
            NetManager.Ins.GetNearHoursEnergyDataAsync(conf.sortLineServerId ,12, ((request, data) =>
            {
                FWarehouse warehouse = FWarehouse.GetInstance();
                var sortline = warehouse.GetSortingLineWithID(int.Parse(conf.id));
                for (var i = 0; i < data.list.Count; i++)
                {
                    var oneData = data[i];
                    sortline.AddEnergyConsumptionRecord(oneData["quantity"].i,
                        TimeUtil.TimeString2Stamp(oneData["collectionTime"].s));
                }
                sortline.InvalidDataCheck(JsonFildName.SortingLine.Record_EnergyConsumption);

                GlobalEvent.DispatchEvent(EventName.RecordEnergyConsumptionUpdate);


                // 近12小时的能耗数据（当天）                      [{
                //     collectionTime: "",
                //     sortLine: "线A",
                //     quantity: 0
                // }]
            }));
        }
    }
    
    /// <summary>
    /// 当前能耗数据
    /// </summary>
    public void RequestCurrentEnergy()
    {
        foreach (var id in PositionConf.sortLineIdList)
        {
            var conf = PositionConf.GetConfById(id);
            NetManager.Ins.GetCurrentEnergyDataAaync(conf.sortLineServerId, ((request, data) =>
            {
                FWarehouse warehouse = FWarehouse.GetInstance();
                var sortline = warehouse.GetSortingLineWithID(int.Parse(conf.id));
            
                for (var i = 0; i < data.list.Count; i++)
                {
                    var oneData = data[i];
                    sortline.CurrentEnergyConsumption = oneData["quantity"].i;
                    sortline.UpdatePullDataTime(JsonFildName.SortingLine.EnergyConsumptionRefreshTime,
                        TimeUtil.TimeString2Stamp(oneData["collectionTime"].s));
                }
            
                GlobalEvent.DispatchEvent(EventName.CurrentEnergyConsumptionUpdate);
            
            }));
        }
    }
    
    /// <summary>
    /// 当前巡查点数据
    /// </summary>
    public void RequestCurrentSpotRoundOfSortingLine()
    {
        foreach (var id in PositionConf.sortLineIdList)
        {
            var conf = PositionConf.GetConfById(id);
            NetManager.Ins.GetCurrentSpotRoundOfSortingLineAsync(conf.sortLineServerId, ((request, data) =>
            {
                // 当前巡查点（没有当前巡查点这样的数据）                                                                                   已巡查点                                        [{
                //     date: "",
                //     sortLine: "",
                //     count: 0
                // }]
                FWarehouse warehouse = FWarehouse.GetInstance();
                for (var i = 0; i < data.list.Count; i++)
                {
                    var oneData = data[i];
                    var sortline = warehouse.GetSortingLineWithID((int.Parse(conf.id)));
                    sortline.CurrentSortingCheckInCompleted = (int) oneData["count"].i;
                    sortline.CurrentSortingCheckInPlan = (int) oneData["count"].i;

                    sortline.UpdatePullDataTime(JsonFildName.SortingLine.CheckRefreshTime,
                        TimeUtil.TimeString2Stamp((string) oneData["date"].s));
                }
                GlobalEvent.DispatchEvent(EventName.CurrStockInOrOutUpdate);

            }));
        }
    }
    
    /// <summary>
    /// 历史巡查点数据
    /// </summary>
    public void RequestRecordSpotRoundOfSortingLine()
    {
        foreach (var id in PositionConf.sortLineIdList)
        {
            var conf = PositionConf.GetConfById(id);
            NetManager.Ins.GetNearDaysSpotRoundOfSortingLineAsync(7, conf.sortLineServerId,((request, data) =>
            {
                FWarehouse warehouse = FWarehouse.GetInstance();
                var sortline = warehouse.GetSortingLineWithID((int.Parse((string)conf.id)));
                for (var i = 0; i < data.list.Count; i++)
                {
                    var oneData = data[i];
                    sortline.AddCheckRecordRecord((int) oneData["count"].i, (int) oneData["count"].i,
                        TimeUtil.TimeString2Stamp((string) oneData["date"].s));
                }
                sortline.InvalidDataCheck("");

            }));
            GlobalEvent.DispatchEvent(EventName.RecordSortingCheckUpdate);

        }
    }
    
    /// <summary>
    /// 历史分拣线数据
    /// </summary>
    public void RequestRecordSortLine()
    {
        foreach (var id in PositionConf.sortLineIdList)
        {
            var conf = PositionConf.GetConfById(id);
            NetManager.Ins.GetNearDaySortLineTrendAsync(12, conf.sortLineServerId, ((request, data) =>
            {
                FWarehouse warehouse = FWarehouse.GetInstance();
                var sortline = warehouse.GetSortingLineWithID((int.Parse(conf.id)));
                for (var i = 0; i < data.list.Count; i++)
                {
                    var oneData = data[i];
                    sortline.AddSortingCountRecord((int) oneData["complete"].i, (int)oneData["complete"].i,
                        TimeUtil.TimeString2Stamp((string) oneData["collectionTime"].s));
                    sortline.AddSortingDurationRecord(oneData["durationSorting"].f, TimeUtil.TimeString2Stamp((string) oneData["collectionTime"].s));
                    sortline.AddSortingEfficientRecord(oneData["sortEfficiency"].f, TimeUtil.TimeString2Stamp((string) oneData["collectionTime"].s));
                }
                sortline.InvalidDataCheck("");

                GlobalEvent.DispatchEvent(EventName.RecordSortingLineDataUpdate);

            }));
        }
    }

    /// <summary>
    /// 当前分拣线数据
    /// </summary>
    public void RequestCurrentSortLine()
    {
        foreach (var id in PositionConf.sortLineIdList)
        {
            var conf = PositionConf.GetConfById(id);
            NetManager.Ins.GetCurrentSortLineDataAsync(conf.sortLineServerId, ((request, data) =>
            {
                // 实时的分拣数据（当天）                             [{
                //     collectionTime: "",
                //     sortDate: "",
                //     sortLine: "",
                //     total: 0,
                //     complete: 0,
                //     durationSorting: 0.0,
                //     totalOrderNum: 0
                // }]
                FWarehouse warehouse = FWarehouse.GetInstance();
                var sortline = warehouse.GetSortingLineWithID(int.Parse(conf.id));

                for (var i = 0; i < data.list.Count; i++)
                {
                    var oneData = data[i];
                    sortline.CurrentSortingData.SortingCountInCompleted = (int) oneData["complete"].i;
                    sortline.CurrentSortingData.SortingCountInPlan = (int) oneData["total"].i;
                    sortline.CurrentSortingData.SortingDuration = (int) oneData["durationSorting"].i;
                    sortline.CurrentSortingData.SortingEfficient = (int) oneData["sortEfficiency"].i;
                    sortline.UpdatePullDataTime(JsonFildName.SortingLine.EnergyConsumptionRefreshTime, TimeUtil.TimeString2Stamp((string)oneData["collectionTime"].s));
                }

                GlobalEvent.DispatchEvent(EventName.CurrentSortingLineDataUpdate);

            }));
        }
       
    }

    /// <summary>
    /// 当前出入库数据
    /// </summary>
    public void RequestCurrentRepertoryAndStockInOrOut()
    {
        NetManager.Ins.GetCurrentWareHouserDaySumAsync(((request, data) =>
        {
            // 出入库的实时数据：                                {
            //     stockInNum：0，
            //     stockOutNum：0，
            //     currentStockNum：0，
            //     bufferStockNum：0，
            //     stockInEfficiency：0，
            //     stockOutEfficiency：0
            // }
            FWarehouse warehouse = FWarehouse.GetInstance();
            var eData = (warehouse.GetEnter().Data as FEnterOrExitData);
            var e2Data = (warehouse.GetExit().Data as FEnterOrExitData);
            eData.CurrentInOrOutStock = (int)data["stockInNum"].i;
            e2Data.CurrentInOrOutStock = (int)data["stockOutNum"].i;
            
            eData.CurrentRepertoryInStore = (int)data["currentStockNum"].i;
            e2Data.CurrentRepertoryInStore = (int)data["currentStockNum"].i;
        
            eData.CurrentRepertoryInBuff = (int)data["bufferStockNum"].i;
            e2Data.CurrentRepertoryInBuff = (int)data["bufferStockNum"].i;
            
            eData.CurrentInOrOutStockEfficient = (int)data["stockInEfficiency"].i;
            e2Data.CurrentInOrOutStockEfficient = (int)data["stockOutEfficiency"].i;
            
            eData.UpdatePullDataTime(JsonFildName.Warehouse.StockInOrOutRefreshTime, TimeUtil.TimeString2Stamp(data["collectionTime"].s));
            e2Data.UpdatePullDataTime(JsonFildName.Warehouse.StockInOrOutRefreshTime, TimeUtil.TimeString2Stamp(data["collectionTime"].s));
        
            GlobalEvent.DispatchEvent(EventName.CurrStockInOrOutUpdate, new Event_CurrentStockInOrOutUpdate());
            GlobalEvent.DispatchEvent(EventName.CurrentRepertoryUpdate, new Event_CurrentRepertoryUpdate());
        }));
    }

        
    /// <summary>
    /// 历史出入库数据
    /// </summary>
    public void RequestRecordStockInOrOut()
    {
        NetManager.Ins.GetWareHouserOfDaysStatisAsync(14, ((request, data) =>
        {
           
                //天数（days，int）
                //date (时间，dateTime（yyyy-MM-dd ）), 
                //stockInNum（入库数量，decimal（18,0）），
                //stockOutNum（出库数量，decimal（18,0）），
                //stockInEfficiency（入库效率，decimal（18,0）），
                //stockOutEfficiency（出库效率，decimal（18,0））                                                Efficiency：0
                // }]     
                FWarehouse warehouse = FWarehouse.GetInstance();
                var eData = (warehouse.GetEnter().Data as FEnterOrExitData);
                var e2Data = (warehouse.GetExit().Data as FEnterOrExitData);
                for (var i = 0; i < data.list.Count; i++)
                {
                    var singleDate = data[i];
                    eData.AddStockInOrOutRecord(singleDate["stockInNum"].i , (int)singleDate["stockInEfficiency"].i, TimeUtil.TimeString2Stamp( singleDate["date"].s));
                    e2Data.AddStockInOrOutRecord( singleDate["stockOutNum"].i , singleDate["stockOutEfficiency"].i, TimeUtil.TimeString2Stamp( singleDate["date"].s));
                    eData.AddRepertoryRecord(singleDate["bufferStockNum"].i, singleDate["bufferStockNum"].i, TimeUtil.TimeString2Stamp( singleDate["date"].s));
                    e2Data.AddRepertoryRecord(singleDate["bufferStockNum"].i, singleDate["bufferStockNum"].i, TimeUtil.TimeString2Stamp( singleDate["date"].s));
                }
                eData.InvalidDataCheck("");
                e2Data.InvalidDataCheck("");

                GlobalEvent.DispatchEvent(EventName.RecordStockInOrOutUpdate, new Event_RecordStockInOrOutUpdate());

        }));
    }
    
    /// <summary>
    /// 分拣线位置
    /// </summary>
    public void RequestSortLineLocation()
    {
        NetManager.Ins.GetSortLineLocationAsync(((request, data) =>
        {
            // if (!data.ContainsKey("error")||data["error"] == null)
            // {
            //     // 分拣线位置信息                                               {
            //     //     id: 0,
            //     //     code: "",
            //     //     name: ""
            //     // },
            // }
        }));


        FWarehouse.UpdateRecordStockInOrOutTest();
        GlobalEvent.DispatchEvent(EventName.RecordStockInOrOutUpdate, new Event_RecordStockInOrOutUpdate());
    }
    
    /// <summary>
    /// 能耗
    /// </summary>
    public void GetDayTotalEnergyAsync()
    {
        NetManager.Ins.GetDayTotalEnergyAsync(((request, data) =>
        {
            
        }));


        GlobalEvent.DispatchEvent(EventName.RecordStockInOrOutUpdate, new Event_RecordStockInOrOutUpdate());
    }
    
    /// <summary>
    /// 分拣总量
    /// </summary>
    public void GetDayTotalSortLIneDataAsync()
    {
        NetManager.Ins.GetSortLineLocationAsync(((request, data) =>
        {
                
        }));


        GlobalEvent.DispatchEvent(EventName.RecordStockInOrOutUpdate, new Event_RecordStockInOrOutUpdate());
    }
    
    /// <summary>
    /// 分拣线报警信息
    /// </summary>
    public void GetWarningInfoOfSortLineAsync()
    {
        NetManager.Ins.GetWarningInfoOfSortLineAsync(((request, data) =>
        {
            
            FWarehouse warehouse = FWarehouse.GetInstance();
            foreach (var p in PositionConf.PositionConfDict)
            {
                var sortline = warehouse.GetLocationWithID(int.Parse(p.Value.id));
                sortline.WarningLevel = EWarningLevel.E_None;
            }
            for (var i = 0; i < data.list.Count; i++)
            {
                var conf = PositionConf.GetConfByServerId(data["sortLineId"].i);
                if (conf == null)
                {
                    continue;
                }
                var sortline = warehouse.GetLocationWithID(int.Parse(conf.id));
                sortline.WarningLevel = (EWarningLevel)data["warnLevelStr"].i;
                UI_MainWnd.Ins.PushWaringInfo(int.Parse(conf.id), data, conf);
            }

            UI_MainWnd.Ins.ClearWaringInfo();
            UI_MainWnd.Ins.Warehouse.RefreshStatus();
        }));
    }
    
    /// <summary>
    /// 温湿度预警线                                   
    /// </summary>
    public void GetTHWarningInfoAsync()
    {
        NetManager.Ins.GetTHWarningInfoAsync(((request, data) =>
        {
            foreach (var mtjsonObject in data.list)
            {
                var dict = mtjsonObject.dict;
                if (dict.ContainsKey("HumUpperLimit"))
                {
                    GlobalValue.MaxLimitHumidity = data["HumUpperLimit"].i;
                }else if (dict.ContainsKey("HumLowerLimit"))
                {
                    GlobalValue.MinLimitHumidity = data["HumLowerLimit"].i;
                }else if (dict.ContainsKey("TempUpperLimit"))
                {
                    GlobalValue.MinLimitHumidity = data["TempUpperLimit"].i;
                }else if (dict.ContainsKey("TempLowerLimit"))
                {
                    GlobalValue.MinLimitHumidity = data["TempLowerLimit"].i;
                }
            }
        }));
    }
    
    /// <summary>
    /// 工单数据
    /// </summary>
    public void GetDaySortLineWorkOrderByTypeAsync()
    {
        NetManager.Ins.GetDaySortLineWorkOrderByTypeAsync((request, o) =>
        {
            UI_Overview2.Ins.RecordWorkOrderUpdate(o);

        });

        NetManager.Ins.GetDayTotalSortLIneDataAsync((request, o) =>
        {
            UI_Overview2.Ins.CurrentSortingDataUpdate(o);

        });
        
        NetManager.Ins.GetDayTotalEnergyAsync((request, o) =>
        {
            UI_Overview2.Ins.CurrentEnergyUpdate(o);

        });
    }
    
    #region Request Test
	#region Exit Enter
	public void TestRequestCurrentTemperature()

    {

    }

    public void TestRequestCurrentRepertory()
    {
        FWarehouse.UpdateCurrentRepertoryTest();
        GlobalEvent.DispatchEvent(EventName.CurrentRepertoryUpdate, new Event_CurrentRepertoryUpdate());
    }

    public void TestRequestRecordRepertory()
    {
        FWarehouse.UpdateRecordRepertoryTest();
        GlobalEvent.DispatchEvent(EventName.RecordRepertoryUpdate, new Event_RecordRepertoryUpdate());
    }

	#endregion
	#region SortingLine
	public void TestRequestCurrentEnergyConsumption()
    {
        FWarehouse.UpdateCurrentEnergyConsumptionTest();
        GlobalEvent.DispatchEvent(EventName.CurrentEnergyConsumptionUpdate, new Event_CurrentEnergyConsumptionUpdate());
    }

    public void TestRequestCurrentSortingLineData()
    {
        FWarehouse.UpdateCurrentSortingLineDataTest();
        GlobalEvent.DispatchEvent(EventName.CurrentSortingLineDataUpdate, new Event_CurrentSortingLineDataUpdate());
    }

    public void TestRequestCurrentSortingCheck()
    {
        FWarehouse.UpdateCurrentSortingCheckTest();
        GlobalEvent.DispatchEvent(EventName.CurrentSortingCheckUpdate, new Event_CurrentSortingCheckUpdate());
    }

    public void TestRequestRecordEnergyConsumption()
    {
        FWarehouse.UpdateRecordEnergyConsumptionTest();
        GlobalEvent.DispatchEvent(EventName.RecordEnergyConsumptionUpdate, new Event_RecordEnergyConsumptionUpdate());
    }

    public void TestRequestRecordSortingLineData()
    {
        FWarehouse.UpdateRecordSortingLineDataTest();
        GlobalEvent.DispatchEvent(EventName.RecordSortingLineDataUpdate, new Event_RecordSortingLineDataUpdate());
    }

    public void TestRequestRecordSortingCheck()
    {
        FWarehouse.UpdateRecordSortingCheckTest();
        GlobalEvent.DispatchEvent(EventName.RecordSortingCheckUpdate, new Event_RecordSortingCheckUpdate());
    }
    #endregion

    #region OverView
    public void TestRequestCurrentVisitorUpdate()
    {
        FWarehouse.UpdateVisitorCurrentDataTest();
        GlobalEvent.DispatchEvent(EventName.CurrentVisitorUpdate, new Event_CurrentVisitorUpdate());
    }

    public void TestRequestCurrentAirPressureUpdate()
    {
        FWarehouse.UpdateAirPressureCurrentDataTest();
        GlobalEvent.DispatchEvent(EventName.CurrentAirPressureUpdate, new Event_CurrentAirPressureUpdate());
    }

    public void TestRequestCurrentVoltageUpdate()
    {
        FWarehouse.UpdateVoltageCurrentDataTest();
        GlobalEvent.DispatchEvent(EventName.CurrentVoltageUpdate, new Event_CurrentVoltageUpdate());
    }

    public void TestRequestRecordVisitorUpdate()
    {
        FWarehouse.UpdateVoltageRecordData();
        GlobalEvent.DispatchEvent(EventName.RecordVisitorUpdate, new Event_RecordVisitorUpdate());
    }

    public void TestRequestRecordAirPressureUpdate()
    {
        FWarehouse.UpdateVoltageRecordData();
        GlobalEvent.DispatchEvent(EventName.RecordAirPressureUpdate, new Event_RecordVisitorUpdate());
    }

    public void TestRequestRecordVoltageUpdate()
    {
        FWarehouse.UpdateVoltageRecordData();
        GlobalEvent.DispatchEvent(EventName.RecordVoltageUpdate, new Event_RecordVoltageUpdate());
    }
    #endregion

    #endregion
}
